package com.example.demo.service;

import com.example.demo.mapper.UserMapper;
import com.example.demo.model.UserInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserService {
    @Autowired
    private UserMapper userMapper;
    public List<UserInfo> getAll(){
        return userMapper.getAll();
    }

    public int add(UserInfo userInfo) {
        return userMapper.add(userInfo);
    }

    public int add2(UserInfo userInfo) {
        return userMapper.add2(userInfo);
    }


    public int updatePassword(Integer id, String password) {
        return userMapper.updatePassword(id,password);
    }

    public int del(int id) {
        return userMapper.del(id);
    }

    public List<UserInfo> findByName(String name) {
        return userMapper.findByName(name);
    }

    public List<UserInfo> getAll2(String order) {
        return userMapper.getAll2(order);
    }

    public UserInfo login(String username, String password) {

        return userMapper.login(username,password);
    }

    public int add3(String username, String password) {
        return userMapper.add3(username,password,null,1);
    }
}
